package com.danco.sn.entities;

import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.danco.sn.apientities.Entities;
import com.danco.sn.apientities.ICommunity;
import com.danco.sn.apientities.INews;

@Entity
@Table(name = "news_community")
public class NewsCommunity implements INews {

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "id_news")
	private Integer idNews;

	@ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY, targetEntity = Community.class)
	@JoinColumn(name = "id_community")
	private ICommunity community;

	@Column(name = "news_date")
	private Date newsDate;

	@Column(name = "news_name")
	private String textNews;

	public Integer getIdNews() {
		return idNews;
	}

	public void setIdNews(Integer idNews) {
		this.idNews = idNews;
	}

	public Date getNewsDate() {
		return newsDate;
	}

	public void setNewsDate(Date newsDate) {
		this.newsDate = newsDate;
	}

	public String getTextNews() {
		return textNews;
	}

	public void setTextNews(String textNews) {
		this.textNews = textNews;
	}

	public ICommunity getMessanger() {
		return community;
	}

	public void setMessanger(Entities community) {
		this.community = (ICommunity) community;
	}

}
